import request from '@/utils/request'

//请求模块级别的前缀
const api_name = '/admin/product'

export default {
  /*
    根据123级分类id获取具体的属性列表
    GET /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id}
  */
  getAttrs({category1Id,category2Id,category3Id}){
    return request({
      url:`${api_name}/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,
      method:"get"
    })
  },


  // 新增或修改属性
  //POST /admin/product/saveAttrInfo
  addOrUpdate(data){
    return request({
      url:`${api_name}/saveAttrInfo`,
      method:"post",
      data
    })
  },

  //刪除指定的属性
  // DELETE /admin/product/deleteAttr/{attrId}
  delAttr(attrId){
    return request({
      url:`${api_name}/deleteAttr/${attrId}`,
      method:"delete",
    })
  }
}
